/**
 * ***********************************************************
 * Castor CodeGen 1.2.1 with SoNiC ME serialization patch:    
 * ***********************************************************
 * @author Adam Dec (SoNiC, snc85@o2.pl)
 * @since 14-12-2008
 * @update 14-02-2009
 * ***********************************************************
 * 
 * ***********************************************************
 * Changed Castor CodeGen 1.2 classes:
 *  - JType.java
 *  - CollectionMemberAndAccessorFactory.java
 *  - SourceFactory.java
 * ***********************************************************
 */

package com.sonic.mquotes.dto;

  //---------------------------------/
 //- Imported classes and packages -/
//---------------------------------/

import org.exolab.castor.xml.Marshaller;
import org.exolab.castor.xml.Unmarshaller;

/**
 * Class Pap_categoryType.
 * 
 * @version $Revision$ $Date$
 */
public class Pap_categoryType implements de.enough.polish.io.Externalizable {


      //--------------------------/
     //- Class/Member Variables -/
    //--------------------------/

    /**
     * Field _id.
     */
    private int _id;

    /**
     * keeps track of state for field: _id
     */
    private boolean _has_id;

    /**
     * Field _pap_subcategory.
     */
    private com.sonic.mquotes.dto.Pap_subcategory _pap_subcategory;


      //----------------/
     //- Constructors -/
    //----------------/

    public Pap_categoryType() {
        super();
    }


      //-----------/
     //- Methods -/
    //-----------/

    /**
     */
    public void deleteId(
    ) {
        this._has_id= false;
    }

    /**
     * Returns the value of field 'id'.
     * 
     * @return the value of field 'Id'.
     */
    public int getId(
    ) {
        return this._id;
    }

    /**
     * Returns the value of field 'pap_subcategory'.
     * 
     * @return the value of field 'Pap_subcategory'.
     */
    public com.sonic.mquotes.dto.Pap_subcategory getPap_subcategory(
    ) {
        return this._pap_subcategory;
    }

    /**
     * Method hasId.
     * 
     * @return true if at least one Id has been added
     */
    public boolean hasId(
    ) {
        return this._has_id;
    }

    /**
     * Method isValid.
     * 
     * @return true if this object is valid according to the schema
     */
    public boolean isValid(
    ) {
        try {
            validate();
        } catch (org.exolab.castor.xml.ValidationException vex) {
            return false;
        }
        return true;
    }

    /**
     * 
     * 
     * @param out
     * @throws org.exolab.castor.xml.MarshalException if object is
     * null or if any SAXException is thrown during marshaling
     * @throws org.exolab.castor.xml.ValidationException if this
     * object is an invalid instance according to the schema
     */
    public void marshal(
            final java.io.Writer out)
    throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
        Marshaller.marshal(this, out);
    }

    /**
     * 
     * 
     * @param handler
     * @throws java.io.IOException if an IOException occurs during
     * marshaling
     * @throws org.exolab.castor.xml.ValidationException if this
     * object is an invalid instance according to the schema
     * @throws org.exolab.castor.xml.MarshalException if object is
     * null or if any SAXException is thrown during marshaling
     */
    public void marshal(
            final org.xml.sax.ContentHandler handler)
    throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
        Marshaller.marshal(this, handler);
    }

    /**
     * Reads data from byte stream.
     * 
     * @param dis
     * @throws java.io.IOException 
     */
    public void read(
            final java.io.DataInputStream dis)
    throws java.io.IOException {
        this._id = dis.readInt();
this._has_id = dis.readBoolean();
this._pap_subcategory = (com.sonic.mquotes.dto.Pap_subcategory)de.enough.polish.io.Serializer.deserialize( dis );

    }

    /**
     * Sets the value of field 'id'.
     * 
     * @param id the value of field 'id'.
     */
    public void setId(
            final int id) {
        this._id = id;
        this._has_id = true;
    }

    /**
     * Sets the value of field 'pap_subcategory'.
     * 
     * @param pap_subcategory the value of field 'pap_subcategory'.
     */
    public void setPap_subcategory(
            final com.sonic.mquotes.dto.Pap_subcategory pap_subcategory) {
        this._pap_subcategory = pap_subcategory;
    }

    /**
     * Method unmarshal.
     * 
     * @param reader
     * @throws org.exolab.castor.xml.MarshalException if object is
     * null or if any SAXException is thrown during marshaling
     * @throws org.exolab.castor.xml.ValidationException if this
     * object is an invalid instance according to the schema
     * @return the unmarshaled com.sonic.mquotes.dto.Pap_categoryTyp
     */
    public static com.sonic.mquotes.dto.Pap_categoryType unmarshal(
            final java.io.Reader reader)
    throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
        return (com.sonic.mquotes.dto.Pap_categoryType) Unmarshaller.unmarshal(com.sonic.mquotes.dto.Pap_categoryType.class, reader);
    }

    /**
     * 
     * 
     * @throws org.exolab.castor.xml.ValidationException if this
     * object is an invalid instance according to the schema
     */
    public void validate(
    )
    throws org.exolab.castor.xml.ValidationException {
        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
        validator.validate(this);
    }

    /**
     * Writes data to byte stream.
     * 
     * @param dos
     * @throws java.io.IOException 
     */
    public void write(
            final java.io.DataOutputStream dos)
    throws java.io.IOException {
        dos.writeInt( this._id );
dos.writeBoolean( this._has_id );
de.enough.polish.io.Serializer.serialize( this._pap_subcategory, dos );

    }

}
